<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;

class MemberController extends Controller
{

    /**
     * 显示用户列表
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $field = [
            'shop_Member.id',
            'shop_MemberInfo.pic',
            'shop_MemberInfo.nickName',
            'shop_Member.email',
            'shop_Member.phone',
            'shop_Member.status',
            'shop_Member.accesstime',
        ];
        $res = DB::table('shop_Member')->join('shop_MemberInfo', 'shop_Member.id', '=', 'shop_MemberInfo.Mid')
                                ->select($field)
                                ->get();
        $status = ['1' => '正常', '2' => '禁用'];
        return View('admin.memberList',['Members' => $res, 'status' => $status]);
    }
    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * 显示用户详情
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $Member = DB::table('shop_Member')->join('shop_MemberInfo', 'shop_Member.id', '=', 'shop_MemberInfo.Mid')
                                          ->first();
        dd($Member);
    }

    /**
     * 显示修改页面
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * 处理修改逻辑
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * 删除逻辑
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }

    public function aa()
    {
        return 's';
    }
}
